" 1.confirm 实现多选对话框
let answer = confirm('Is cat your favorite animal?', "&yes\n&no")
echo answer
" 1.1.返回结果是整数
" 1.2.&标记选项按键

" 2.input 支持更自由格式输入
let animal = input('What is your favorite animals?')
echo "\n"
echo 'What a coincidence! My favorite animal is a ' . animal . ' too!'

" 3.在键盘映射中使用input函数
" 需要先调用 inputsave(),并在之后调用inputrestore()
function AskAnimalName()
    call inputsave()
    let name = input('What is the animal''s name? ')
    cal inputrestore()
    return name
endfunction

nnoremap <leader>a = : let name = AskAnimalName()<cr>:echo name <cr>
